// 聊天互动
const chatMixin = {
	data(){
		return{
			//互动数据列表
			chatList:[],
		}
	},
	methods:{
		// 接收推送的聊天数据
		appendChatList(data){
			data.dataList.map(item=>{
				if((item.userId == this.clientUserId) 
				|| (item.userId == 'teacher' && item.nickName == this.teacherName)){
					item.position = 'right';
				}else{
					item.position = 'left';
				}
			})
			this.chatList = [...this.chatList, ...data.dataList];
			this.goBottom(); // scroll置底
		}
	}
}

export default chatMixin;